package src.com.ny.view;

import src.com.ny.entity.Product;
import src.com.ny.entity.Student;
import src.com.ny.service.impl.ProductServiceImpl;

import java.sql.SQLException;
import java.util.List;
import java.util.Scanner;

public class IndexView {


    public void indexView() throws SQLException, ClassNotFoundException {
        ProductServiceImpl productService = new ProductServiceImpl();

        System.out.println("请选择相应操作");
        System.out.println("1.个人信息界面");
        System.out.println("2.查看商品信息");
        System.out.println("3.查看订单信息");
        Scanner scanner = new Scanner(System.in);
        int choice = scanner.nextInt();
        switch (choice) {
            case 1:
                System.out.println("个人信息界面");
                break;
            case 2:
                System.out.println("商品信息界面");
                List<Product> products =productService.findAllProduct();
                System.out.println("商品序号"+"\t"+"商品名称"+"\t"+"商品价格"+"\t"+"商品库存"+"\t"+"商品类别"+"\t"+"商品描述");
                for (Product product : products) {
                    System.out.println(product.getProduct_id());
                    System.out.println("\t" + "\t");
                    System.out.println(product.getName());
                    System.out.println("\t" + "\t");
                    System.out.println(product.getPrice());
                    System.out.println("\t" + "\t");
                    System.out.println(product.getStock());
                    System.out.println("\t" + "\t");
                    System.out.println(product.getCategory());
                    System.out.println("\t" + "\t");
                    System.out.println(product.getDescription());
                }
                System.out.println("请输入你需要购买的商品序号");
                int product_id = scanner.nextInt();
                System.out.println("请输入你需要购买的商品数量");
                int number = scanner.nextInt();
                            break;
            case 3:
                System.out.println("订单信息界面");
            default:
                System.out.println("无效选项");
                break;
           }
        }

    }

